home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
-
- main()
- {
- char* server_software;
-
- printf("Content-type: text/html\n\n");
-
- printf("<HTML>\n");
- printf("<HEAD><TITLE>CGI Script How-to: Test Script</TITLE></HEAD>\n");
- printf("<BODY>\n");
-
- printf("<H1>CGI Script How-to<BR>determine the type of server software</H1>\n");
-
- server_software = getenv("SERVER_SOFTWARE");
-
- if (server_software != NULL &&
- strncmp(server_software, "NCSA", 4) == 0)
- {
- /* Do something specific for NCSA HTTPd server software */
- printf("Congratulations, you have a <B>NCSA HTTPd</B> server!\n");
- printf("<P>\n");
- printf("The complete server name is %s.\n", server_software);
- }
- else
- {
- /* Do something else for all other servers */
- printf("You have a <B>%s</B> server.\n", $server_software);
- }
-
- printf("</BODY></HTML>\n\n");
- exit(0);
- }
-